Extract rollout-redis as a separate adapter gem - #181
Closed
michal-granec wants to merge 5 commits into
Closed
Conversation
3 tasks
Move Redis persistence and history into Rollout::Redis::Backend. Core Rollout takes a backend and no longer depends on redis.
setup-ruby should install rollout-redis/Gemfile from that directory so BUNDLE_GEMFILE is unnecessary and bundle exec rspec finds the gems.
Bump core to 3.0.0, require a compatible core range in the adapter, and keep logging/observer snapshot eligibility consistent through a mutation.
michal-granec
force-pushed
the
v3-redis-backend
branch
from
September 9, 2026 13:39
6ea71cc to
a8328e7
Compare
Read only the requested history entries, decode Redis events in the adapter, and give the backend a clear_features hook so clear! can remove the empty registry without changing logging-disabled delete behavior.
The shared examples live in the repository spec/support directory, two levels above the adapter specs.
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved CI/release packaging, Bundler compatibility, and backend-isolation issues block approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This pull request extracts Redis persistence into the standalone rollout-redis adapter and makes core Rollout backend-neutral.
Changes:
- Adds backend contracts and backend-based core persistence.
- Introduces the Redis adapter, codec, and adapter-specific tests.
- Updates packaging, documentation, Rake tasks, and CI workflows.
File summaries
| File | Summary |
|---|---|
spec/support/backend_contract.rb |
Defines shared backend contract examples. |
spec/spec_helper.rb |
Provides the in-memory test backend; fetched states need deep cloning for isolation. |
spec/rollout/logging_spec.rb |
Tests backend-neutral logging. |
spec/rollout/feature_state_spec.rb |
Tests backend-neutral feature state behavior. |
spec/rollout/feature_spec.rb |
Tests feature behavior. |
spec/rollout_spec.rb |
Tests core Rollout behavior. |
rollout.gemspec |
Removes the Redis dependency and extracted files. |
rollout-redis/spec/spec_helper.rb |
Configures adapter test setup. |
rollout-redis/spec/rollout_integration_spec.rb |
Tests Redis integration behavior. |
rollout-redis/spec/history_spec.rb |
Tests Redis history behavior. |
rollout-redis/spec/codec_spec.rb |
Tests Redis codec behavior. |
rollout-redis/spec/backend_contract_spec.rb |
Applies the backend contract to Redis. |
rollout-redis/rollout-redis.gemspec |
Defines the adapter gem. |
rollout-redis/lib/rollout/redis/codec.rb |
Implements Redis encoding and decoding. |
rollout-redis/lib/rollout/redis/backend.rb |
Implements Redis persistence and history. |
rollout-redis/lib/rollout/redis.rb |
Provides the adapter entry point. |
rollout-redis/Gemfile |
Defines adapter dependencies. |
rollout-redis/.rspec |
Configures adapter RSpec. |
README.md |
Documents adapter installation and usage. |
Rakefile |
Adds core and adapter test tasks; older Bundler compatibility remains unresolved. |
lib/rollout/version.rb |
Sets version 3.0.0. |
lib/rollout/redis_codec.rb |
Removes the core Redis codec. |
lib/rollout/logging.rb |
Delegates history storage to backends. |
lib/rollout.rb |
Uses backend-based persistence. |
.github/workflows/test.yml |
Splits core and Redis CI; adapter setup needs its own Gemfile. |
.github/workflows/release.yml |
Tests the adapter, but the release still excludes publishing it and needs adapter bundle setup. |
Review details
Suppressed comments (4)
.github/workflows/release.yml:33
- This setup step has the same ineffective
working-directoryinput, so the release job does not install the adapter bundle before runningbundle exec rspecfromrollout-redis; with Redis removed from the root bundle, the adapter tests can fail immediately onrequire 'redis'. ConfigureBUNDLE_GEMFILEfor the setup step or run an explicit adapterbundle install.
working-directory: rollout-redis
.github/workflows/test.yml:59
working-directoryis being passed as an input toruby/setup-ruby, so it does not change the directory in whichbundler-cacheruns. The action will install the root Gemfile (which no longer includesredis), while the following command resolvesrollout-redis/Gemfileand can fail atrequire 'redis'; setBUNDLE_GEMFILEfor this setup step or add an explicit adapterbundle install.
working-directory: rollout-redis
Rakefile:16
- The gemspec still permits Bundler
>= 1.17, butwith_unbundled_envis not available in Bundler 1.x. The documentedbundle exec rake spec:rediscommand therefore raises before running tests on an allowed Bundler version; use awith_clean_envfallback for older Bundlers.
Bundler.with_unbundled_env do
sh({ "BUNDLE_GEMFILE" => gemfile }, "bundle exec rspec")
spec/spec_helper.rb:17
- This test double stores and returns the same
FeatureStateinstance, so mutating a nested value on a fetched state also mutates the backend. That violates the isolation required by the shared backend contract inspec/support/backend_contract.rb; return a deep clone fromfetch_featureso core tests exercise the same contract as the Redis adapter.
@features[name.to_s] || Rollout::FeatureState.new(name: name, percentage: 0)
- Files reviewed: 26/26 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+30
to
+37
| - name: Setup Redis adapter gems | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| working-directory: rollout-redis | ||
| bundler-cache: true | ||
| - name: Run Redis adapter tests | ||
| working-directory: rollout-redis | ||
| run: bundle exec rspec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #180.
Summary
rollout-redis(Rollout::Redis::Backend+Rollout::Redis::Codec).Rolloutnow takesbackend:and no longer depends on redis.rollout-redis/spec.This is the second Rollout 3 slice. It does not add Active Record, change hashing, or raise the Ruby requirement.
Test plan
Rollout.new(backend: Rollout::Redis::Backend.new(redis))activates, deactivates, and evaluates as beforehistory_length;deleteremoves feature history;clear!keeps itChecks: core 20 examples passed, Redis adapter 103 examples passed, rebased onto
v3-feature-state.